package com.example.a001.part26;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

import com.example.a001.R;

public class MainActivity extends AppCompatActivity {

    private EditText etName, etPhone, etEmail;
    private Button btnAddContact;

    @SuppressLint("MissingInflatedId")
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main8);

        // 初始化视图
        etName = findViewById(R.id.etName);
        etPhone = findViewById(R.id.etPhone);
        etEmail = findViewById(R.id.etEmail);
        btnAddContact = findViewById(R.id.btnAddContact);

        // 设置点击事件
        btnAddContact.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String name = etName.getText().toString();
                String phone = etPhone.getText().toString();
                String email = etEmail.getText().toString();

                // TODO: 这里可以执行保存联系人逻辑，例如存入数据库或 Toast 显示
            }
        });
    }
}
